$(function(){



	//主功能框架渲染
	domain.init()

	//开始滚动监听
	nav.scrollevent(".main","#list","#navlist")
	
	//搜索监听
	seacherInput.init()


	//广告展示
	//
	wxCloud.cloud().callFunction(

		{
			name:'gitSgbVersion',
			data:{
				dbname:'sgb-guangao-imgup'
			},
			success:function(res){
				

				var amIndex =  res.result.data[0]['imgFileName']

				// console.log('广告展示调用成功=>',res)

				if(lsa.get('showGg') == null || lsa.get('showGg') !== amIndex){
					var src =`
						<div id="timeshow" style="position: absolute;right:5px;top:5px;color:#fff;">5秒后自动消失</div>
						<img style="width:100%" src="./img/${amIndex}"></img>
						<script>
							$(function(){
								var i = 5;
								setInterval(function(){
									i-=1
									$("#timeshow").text(i + "秒后自动消失")

								},1000)

							})
						</script>
					  `

					layer.open({

						  type: 1,
						  title: false,
						  closeBtn: 0,
						  area: ['100%','100%'],
						  skin: 'layui-layer-nobg', //没有背景色
						  shadeClose: false,
						  content: src,
						  time:5000

					})

					lsa.set('showGg',amIndex)
				}

			},
			fail:function(erro){

				console.log(erro)
			}
		}
	)



})



